package com.wish.blessingroad.entity;

import java.io.Serializable;
import java.math.BigDecimal;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.time.LocalDateTime;

import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * <p>
 *
 * </p>
 *
 * @author dhc
 * @since 2019-02-18
 */
@Data
@Accessors(chain = true)
@TableName("orders")
public class Orders extends Model<Orders> {

    private static final long serialVersionUID = 1L;
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    private String orderId;
    private String transactionId;//微信支付订单号
    private Integer blessingId;

    /**
     * 状态：0进行中  1成功  2失败
     */
    private Integer status = 0;

    private Integer userId;

    private int orderValue;//分为单位

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createDate = LocalDateTime.now();
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateDate;
    /**
     * 类型1现金  2分享  3人工  4其它
     */
    private Integer type;


    /**
     * 指定主键
     */
    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    public Orders() {
    }

    public Orders(Integer status) {
        this.status = status;
    }

    public Orders(String orderId, String transactionId, Integer blessingId, Integer status,
            Integer userId, int orderValue, LocalDateTime createDate, Integer type) {
        this.orderId = orderId;
        this.transactionId = transactionId;
        this.blessingId = blessingId;
        this.status = status;
        this.userId = userId;
        this.orderValue = orderValue;
        this.createDate = createDate;
        this.type = type;
    }

    public static final String ID = "id";

    public static final String ORDER_ID = "order_id";

    public static final String BLESSING_ID = "blessing_id";

    public static final String STATUS = "status";

    public static final String USER_ID = "user_id";

    public static final String ORDER_VALUE = "order_value";

    public static final String CREATE_DATE = "create_date";

    public static final String UPDATE_DATE = "update_date";
    public static final String TRANSACTION_ID = "transaction_id";

    public static final String TYPE = "type";

}
